#!/bin/bash
 
echo '========================================='
echo 'nemo-api excute.....'
echo 'sourcepath:'$1,'targetpath:'$2
echo '========================================='
path1=$1
path2=$2
echo "copy ....jar"
#cp /root/disk1/jenkinsworkspace/workspace/dev_nemo_api/nemo-api/excute.sh /data/wwwroot/apitest.nemo.pro/excute.sh
#/data/wwwroot/apitest.nemo.pro/excute.sh /root/disk1/jenkinsworkspace/workspace/dev_nemo_api/nemo-api  /data/wwwroot/apitest.nemo.pro
#/root/disk1/jenkinsworkspace/workspace/dev_nemo_api/nemo-api
#/data/wwwroot/apitest.nemo.pro
cp $path1/target/nemo-api-1.0.jar $path2/nemo-api-1.0.jar
echo "copy script"
cp $path1/excute.sh $path2/excute.sh
cp $path1/Dockerfile $path2/Dockerfile
cp $path1/docker-compose.yml $path2/docker-compose.yml
echo "enter ................1"
cd $path2
pwd
echo "enter ................1"

echo "add Permission......."
chmod u+x excute.sh
echo 'start docker.............'
sudo docker-compose down
echo "down over"
#sudo docker rmi $(docker images -f "dangling=true" -q)
echo "delete none images"
sudo docker-compose up --force-recreate --build -d
echo "up over"


